home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Transformers: Revenge of …he Game: Press Kit (USA)
/
Transformers - Revenge of the Fallen - The Game - Press Kit (USA).bin
/
Transformers.swf
/
scripts
/
fl
/
video
/
FPADManager.as
< prev
next >
Wrap
Text File
|
2009-06-19
|
4KB
|
107 lines
package fl.video
{
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.events.SecurityErrorEvent;
import flash.net.URLLoader;
import flash.net.URLRequest;
public class FPADManager
{
public static const VERSION:String = "2.1.0.19";
public static const SHORT_VERSION:String = "2.1";
flvplayback_internal var _uriParam:String;
flvplayback_internal var _parseResults:ParseResults;
private var _owner:INCManager;
flvplayback_internal var rtmpURL:String;
flvplayback_internal var _url:String;
flvplayback_internal var xmlLoader:URLLoader;
flvplayback_internal var xml:XML;
public function FPADManager(param1:INCManager)
{
super();
_owner = param1;
}
flvplayback_internal function connectXML(param1:String, param2:String, param3:String, param4:ParseResults) : Boolean
{
_uriParam = param2;
_parseResults = param4;
_url = param1 + "uri=" + flvplayback_internal::_parseResults.protocol;
if(flvplayback_internal::_parseResults.serverName != null)
{
_url += "/" + flvplayback_internal::_parseResults.serverName;
}
if(flvplayback_internal::_parseResults.portNumber != null)
{
_url += ":" + flvplayback_internal::_parseResults.portNumber;
}
if(flvplayback_internal::_parseResults.wrappedURL != null)
{
_url += "/?" + flvplayback_internal::_parseResults.wrappedURL;
}
_url += "/" + flvplayback_internal::_parseResults.appName;
_url += param3;
xml = new XML();
xmlLoader = new URLLoader();
flvplayback_internal::xmlLoader.addEventListener(Event.COMPLETE,flvplayback_internal::xmlLoadEventHandler);
flvplayback_internal::xmlLoader.addEventListener(IOErrorEvent.IO_ERROR,flvplayback_internal::xmlLoadEventHandler);
flvplayback_internal::xmlLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR,flvplayback_internal::xmlLoadEventHandler);
flvplayback_internal::xmlLoader.load(new URLRequest(flvplayback_internal::_url));
return false;
}
flvplayback_internal function xmlLoadEventHandler(param1:Event) : void
{
var proxy:String = null;
var e:Event = param1;
try
{
if(e.type != Event.COMPLETE)
{
_owner.helperDone(this,false);
}
else
{
xml = new XML(flvplayback_internal::xmlLoader.data);
if(flvplayback_internal::xml == null || flvplayback_internal::xml.localName() == null)
{
throw new VideoError(VideoError.INVALID_XML,"URL: \"" + flvplayback_internal::_url + "\" No root node found; if url is for an flv it must have .flv extension and take no parameters");
}
if(flvplayback_internal::xml.localName() != "fpad")
{
throw new VideoError(VideoError.INVALID_XML,"URL: \"" + flvplayback_internal::_url + "\" Root node not fpad");
}
proxy = null;
if(flvplayback_internal::xml.proxy.length() > 0 && flvplayback_internal::xml.proxy.hasSimpleContent() && flvplayback_internal::xml.proxy.*[0].nodeKind() == "text")
{
proxy = flvplayback_internal::xml.proxy.*[0].toString();
}
if(proxy == null)
{
throw new VideoError(VideoError.INVALID_XML,"URL: \"" + flvplayback_internal::_url + "\" fpad xml requires proxy tag.");
}
rtmpURL = flvplayback_internal::_parseResults.protocol + "/" + proxy + "/?" + flvplayback_internal::_uriParam;
_owner.helperDone(this,true);
}
}
catch(err:Error)
{
_owner.helperDone(this,false);
throw err;
}
}
}
}